<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>

    //检测数组内元素出现的个数
// 调用示例
const arr = [1, 2, 4, 5, 1, 4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 5, 4, 5, 4, 5, 4,5, 5, 5, 5, 5, 5,  5]
const o = {}
let name = ''
let value = ''
for(let i = 0; i < arr.length; i++) {
  if(o[arr[i]]) {
    o[arr[i]]++
  }else {
    o[arr[i]] =1
  }
}
console.log(o);

for(let k in o) {
  if(o[k] > value) {
    name = k
    value = o[k]
  }
}
console.log({name, value});

  </script>
</body>
</html>